package cn.com.dhcc.app.pub.core.job;

import org.apache.log4j.Logger;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import cn.com.dhcc.app.core.exception.NiceException;
import cn.com.dhcc.app.core.exception.ServiceException;
import cn.com.dhcc.app.core.service.Log;
import cn.com.dhcc.app.core.service.Log.LOGTYPE;
import cn.com.dhcc.app.pub.CM;
import cn.com.dhcc.ddi.monitor.service.MonitorService;

public class CheckStatusJob implements Job{

	private static Logger logger = Log.getLogger(LOGTYPE.DDI);
	
	public synchronized void CheckStatus() {
		MonitorService monitorService = CM.getBean(MonitorService.class);
		try {
			monitorService.checkPublishStatus();
		} catch (ServiceException e) {
			logger.error("检查数据源状态异常",e);
		} catch (NiceException e) {
			logger.error("检查数据源状态异常",e);
		}
	}

	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {
		CheckStatus();
	}
}
